<?php	
/*
# ------------------------------------------------------------------------
# JD Base Theme
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
//get general info and store to js variable
$t3_general = $t3_setting->getGeneral();


$general_js = 'var t3_general = ' . drupal_to_js($t3_general) . ";\n";
drupal_add_js($general_js, 'inline');

$form[] = array(
	'#value'=>'<div id="theme-general">'
);

$html = '';


if(!$_COOKIE['theme-general-t3-help']){
	$help_style = "style=\"display:block\"";
}else{
	$help_style = "style=\"display:none\"";
}

$html .= '<div id="theme-general-t3-help" class="ja-inner-help" '.$help_style.'>';
	
$html .= '<a title="'.t('Hide').'" class="ja-help-close" href="javascript:void(0)" onclick="t3_close_help(this, true)">'.t('Close').'</a>';
$html .= t('<strong>Profile override settings</strong><br />This panel controls the general behavior of the template and allows you to assign profiles to be used for specific pages. The default profile is used for all pages by default, but you can create unlimited profile overrides. <br />Here is a quick guide: <br />* <strong>Step 1</strong> - Click the <em>Click to add</em> to add a page and a small window will pop-up, add your link (example <span style="color:blue">node/*</span>) and click ok.<br />* <strong>Step 2</strong> - Select a profile to be used for this page,<br />* <strong>Step 3</strong> - Click the <span style="font-weight:bold; color:green;">Save configuration</span> button at the bottom to apply the changes.<br />This will produce a profile override so go ahead in the frontend and browse that page you created profile override for. <br /> <a href="http://wiki.joomlart.com/wiki/JD_T3_Framework/Guides#Profile_Override_Settings" target="_blank">Click here</a> to learn more about profile override settings.<br /><br /><strong>System Settings</strong><br />This section allows you to completely shut down all cache by enabling development mode.<br /><a href="http://wiki.joomlart.com/wiki/JD_T3_Framework/Guides#System_Settings" target="_blank">Click here</a> to learn all about this feature in our wiki documentation sources.');
$html .= '</div>';

$form[] = array(
			'#value'=>$html
		);
$form['general'] = array(
	'#type' => 'fieldset',
    '#title' => t('Profile override settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
);

$html = '';

$html .= '<table class="jd-table-general jd-admintable">';
$html .= '<tr>';
$html .= '<th width="75%">'.t('Pages').'</th>';
$html .= '<th width="20%">'.t('Profiles').'</th>';
$html .= '<th>&nbsp;</th>';
$html .= '</tr>';

//assign all page use default profile first
		

foreach ($t3_general as $pages=>$profile){
	if($pages == '#devmode') continue;
	if($pages == 'default'){
		$html .= '<tr>';
		$html .= '<td><span class="general-page all">'.t('All pages').'</span></td>';
		$html .= '<td><span class="profile-text">'.t($profile).'</span></td>';
		$html .= '<td>&nbsp;</td>';
		$html .= '</tr>';
	}else{
		$pages = preg_replace('/[,]+/', ', ', $pages);
		$html .= '<tr>';
		$html .= '<td><span class="general-page">'.htmlspecialchars($pages).'</span></td>';
		$html .= '<td><span class="profile-text">'.t($profile).'</span></td>';
		$html .= '<td><span class="jd-close">&nbsp;</span></td>';
		$html .= '</tr>';
	}
}
//more row for assign more page
$html .= '<tr>';
$html .= '<td><span class="general-page page-more">'.t('Click to add').'</span></td>';
$html .= '<td><span class="profile-text more">&nbsp;</span></td>';
$html .= '<td><span class="jd-close">&nbsp;</span></td>';
$html .= '</tr>';
$html .= '</table>';



$form['general'][]  = array(
	'#value'=>$html
);


$form['system'] = array(
	'#type' => 'fieldset',
    '#title' => t('System settings'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
);

$form['system']['devmode'] = array(
	'#title'=>t('Enable Development Mode'),
	'#description'=>t('It is recomended to switch this setting to *Yes* for development stage of your website. This option will disable all cache, to be able to see changes imediately after page refresh, without clearing the cache.'),
	'#type' =>'radios',
	'#options'=>array('1'=>t('yes'), '0'=>t('no')),
	'#default_value'=>variable_get($theme.'_devmode', 1)
);

$form[] = array(
	'#value'=> '</div>'
);